<template>
	<div id="myConfig">
		<div style="margin-top: 20px;">
			系统管理>>系统配置
		</div>
		<div id="topButton" style="margin-top: 30px;">
			<el-row>
				<el-button type="primary">新增</el-button>
				<el-button type="primary">删除</el-button>
				<el-button type="primary">保存</el-button>
				<el-button type="primary">取消</el-button>
			</el-row>
		</div>
		<template>
			<el-table ref="multipleTable" :data="Config" tooltip-effect="dark" style="width: 100%">

				<el-table-column type="selection" width="55">
					<template slot-scope="scope">
						<el-checkbox v-model="scope.row.isSelected"
							@change="handleSelectionChange(scope.row)"></el-checkbox>
					</template>
				</el-table-column>
				<el-table-column label="配置类型编码" prop="id" width="120">

				</el-table-column>
				<el-table-column label=" 配置类型名称 " prop="configcode" width="120">

				</el-table-column>
				<el-table-column label="  描述 " prop="configvaluename" width="120">
				</el-table-column>
				<el-table-column prop="isstart" label="状态(启用/未启用)">
					<template #default="scope">
						<el-radio-group v-model="scope.row.isstart">
							<el-radio :label="1">启用</el-radio>
							<el-radio :label="0">未启用</el-radio>
						</el-radio-group>
					</template>
				</el-table-column>
			</el-table>
		</template>
		<!-- 上方表单 -->
		<br />
		<!-- 下方表单 -->
		<div id="topButton" style="margin-top: 30px;">
			<el-row>
				<el-button type="primary">新增</el-button>
				<el-button type="primary">删除</el-button>
				<el-button type="primary">保存</el-button>
				<el-button type="primary">取消</el-button>
			</el-row>
		</div>
		<template>
			<el-table ref="multipleTable" :data="Configone" tooltip-effect="dark" style="width: 100%">
				<el-table-column type="selection" width="55">
				</el-table-column>
				<el-table-column label="配置参数ID" prop="configvalueid" width="220">
				</el-table-column>
				<el-table-column label=" 配置参数名称 " prop="configvaluename" width="220">
				</el-table-column>
			</el-table>
		</template>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				Config: [{}],
				Configone: [{}],
				configcode: null
			}
		},
		methods: {
			// 查询方法
			chaxun() {
				this.axios.get("http://localhost:8080/systemconfig/config", {
					params: {}
				}).then((res) => {
					this.Config = res.data.datamap.functions;
				}).catch(err => {
					console.log(err)
				});
			},
			handleSelectionChange(row) {
				if (row.isSelected) {
					console.log('选中的行数据：', row);
					this.axios.get("http://localhost:8080/systemconfig/selectConfigcode", {
						params: {
							configcode: row.configcode
						}
					}).then((res) => {
						this.Configone = res.data.datamap.functions;
					}).catch(err => {
						console.log(err);
					});
				} else {
					this.Configone = []
				}
			}
		},

		mounted() {
			this.chaxun();
		}
	}
</script>

<style>
</style>